<?php
$this->menu=array(
	array('label'=>'New export information', 'url'=>array('create'), 'linkOptions'=>array('id'=>'menu_create')),
);
?>

<h1>Export Informations</h1>
<div class="row">
	<?php echo CHtml::label("Search",'search'); ?>
	<?php echo CHtml::textField('search',''); ?>
	<?php echo CHtml::link('Search','#',array('grid_id'=>'export_info_grid','id'=>'search')); ?>
</div>

<?php
    $this->widget('zii.widgets.grid.CGridView', array(
        'id' => 'export_info_grid',
    'dataProvider' => $model->search(),
    'columns' => array(
        'etd:date:Export date',
        'out_permit:text:Permit',
        'awb:text:Awb/BL',
        'vessel:text:Freight info/Vessel',
        'mode:text:Mode of transport',
        array(
            'class' => 'CButtonColumn',
        ),
    ),
));
?>

<?php
$exportCreateURL = CHtml::normalizeUrl(array('create'));
$cs = Yii::app()->ClientScript;
$script =<<<EOD
$('input#search').keypress(function(event){
	if(event.keyCode == '13'){
		$(this).next('a#search').click();
	}
});
$('a#search').click(function(){
	var searchInput = $(this).prev('input#search');
	$.fn.yiiGridView.update($(this).attr('grid_id'),{data:{searchText:$(searchInput).val()}});
	return false;	
});
EOD;
$cs->registerScript('collection#create#form',$script);
?>